package com.xiaochen.common.exception;

import com.xiaochen.model.vo.common.ResultCodeEnum;
import lombok.Data;

/**
 * 自定义异常类
 * @author pinkhors
 */
@Data
public class XiaoChenException extends RuntimeException{

    // 错误状态码
    private Integer code ;
    // 错误消息
    private String message ;
    // 封装错误状态码和错误消息
    private ResultCodeEnum resultCodeEnum ;

    public XiaoChenException(ResultCodeEnum resultCodeEnum) {
        this.resultCodeEnum = resultCodeEnum ;
        this.code = resultCodeEnum.getCode() ;
        this.message = resultCodeEnum.getMessage();
    }

    public XiaoChenException(Integer code , String message) {
        this.code = code ;
        this.message = message ;
    }


}
